﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:System="clr-namespace:System;assembly=mscorlib"
	xmlns:ViewOn="clr-namespace:ViewOn.UI.Control"
	xmlns:wpf="clr-namespace:ViewOnCore.Helper.WPF;assembly=ViewOnCore"
    xmlns:host="clr-namespace:ViewOnCore.HostContract;assembly=ViewOnCore"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    >

	<Style x:Key="DefaultSliderButtonStyle" TargetType="{x:Type RepeatButton}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="DefaultSliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Height" Value="14"/>
		<Setter Property="Width" Value="14"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Grid>
						<Border
									  x:Name="Ellipse"
									  CornerRadius="2"
									  Background="White"
									  BorderBrush="#77555555"
									  BorderThickness="1" />
						<Border
									  x:Name="highlight"
									  CornerRadius="2"
									  Background="{DynamicResource VOColor02}"
									  BorderBrush="#77555555"
									  BorderThickness="1"
									  Opacity="0"/>
					</Grid>
					<ControlTemplate.Triggers>
						<EventTrigger RoutedEvent="Mouse.MouseEnter">
							<BeginStoryboard>
								<Storyboard>
									<DoubleAnimation To="0.7" Duration="00:00:00.2000000" Storyboard.TargetName="highlight" Storyboard.TargetProperty="Opacity" />
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<EventTrigger RoutedEvent="Mouse.MouseLeave">
							<BeginStoryboard>
								<Storyboard>
									<DoubleAnimation To="0" Duration="00:00:00.2000000" Storyboard.TargetName="highlight" Storyboard.TargetProperty="Opacity" />
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="DefaultHorizontalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<TickBar
									  x:Name="TopTick"
									  SnapsToDevicePixels="True"
									  Placement="Top"
									  Fill="Transparent"
									  Height="4"
									  Visibility="Collapsed" />
			<Viewbox Grid.Row="1">
				<Polygon Points="1,10 100,10 100,0 1,10" Stroke="#FFC8C8C8" StrokeThickness="1" Fill="{DynamicResource VOColor14}" Opacity="0.6"/>
			</Viewbox>
			<Border
									  x:Name="TrackBackground"
									  Margin="0"
									  CornerRadius="2"
									  Height="2"
									  Grid.Row="1"
									  Background="#FFFFFFFF"
									  BorderBrush="#FFFFFFFF"
									  BorderThickness="1" Opacity="0" />
			<Track Grid.Row="1" x:Name="PART_Track">
				<Track.DecreaseRepeatButton>
					<RepeatButton
														  Style="{StaticResource DefaultSliderButtonStyle}"
														  Command="Slider.DecreaseLarge" />
				</Track.DecreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource DefaultSliderThumbStyle}" />
				</Track.Thumb>
				<Track.IncreaseRepeatButton>
					<RepeatButton
														  Style="{StaticResource DefaultSliderButtonStyle}"
														  Command="Slider.IncreaseLarge" />
				</Track.IncreaseRepeatButton>
			</Track>
			<TickBar
									  x:Name="BottomTick"
									  SnapsToDevicePixels="True"
									  Grid.Row="2"
									  Fill="{TemplateBinding Foreground}"
									  Placement="Bottom"
									  Height="4"
									  Visibility="Collapsed" />
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="{x:Type Slider}" TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="MinWidth" Value="30" />
				<Setter Property="MinHeight" Value="21" />
				<Setter Property="Template" Value="{StaticResource DefaultHorizontalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>

	<!-- Slider Template : Position -->
	<Style x:Key="PositionSliderButtonStyle" TargetType="{x:Type RepeatButton}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="PositionSliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Height" Value="14"/>
		<Setter Property="Width" Value="14"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Border
								  x:Name="Ellipse"
								  CornerRadius="0,0,0,0"
								  Background="{DynamicResource VOColor1A}"
								  RenderTransformOrigin="0.5,0.5" Width="6" Height="6" >
						<Border.RenderTransform>
							<TransformGroup>
								<ScaleTransform ScaleX="1" ScaleY="1"/>
								<SkewTransform AngleX="0" AngleY="0"/>
								<RotateTransform Angle="45"/>
								<TranslateTransform X="0" Y="0"/>
							</TransformGroup>
						</Border.RenderTransform>
						<Border.BitmapEffect>
							<OuterGlowBitmapEffect GlowColor="{Binding Source={x:Static host:Host.UIService}, Path=GlowColors.VOGColor10}" GlowSize="3" Noise="0" Opacity="0.5" />
						</Border.BitmapEffect>
					</Border>
					<ControlTemplate.Triggers>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter TargetName="Ellipse" Property="Background" Value="{DynamicResource VOColor02}"/>
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="PositionHorizontalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto" MinHeight="{TemplateBinding MinHeight}"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>
			<TickBar
			  x:Name="TopTick"
			  SnapsToDevicePixels="True"
			  Placement="Top"
			  Fill="Transparent"
			  Height="4"
			  Visibility="Collapsed" />
			<Border
			  x:Name="TrackBackground"
			  Margin="0"
			  CornerRadius="2"
			  Height="1"
			  Grid.Row="1"
			  Background="{DynamicResource VOColor10}"
			  BorderBrush="{DynamicResource VOColor10}"
			  BorderThickness="1">
				<Border.BitmapEffect>
					<OuterGlowBitmapEffect GlowColor="{Binding Source={x:Static host:Host.UIService}, Path=VOGColor10}" GlowSize="3" Noise="0" Opacity="0.5" />
				</Border.BitmapEffect>
			</Border>
			<Track Grid.Row="1" x:Name="PART_Track">
				<Track.DecreaseRepeatButton>
					<RepeatButton
					Style="{StaticResource PositionSliderButtonStyle}"
					Command="Slider.DecreaseLarge"/>
				</Track.DecreaseRepeatButton>
				<Track.IncreaseRepeatButton>
					<RepeatButton
					Style="{StaticResource PositionSliderButtonStyle}"
					Command="Slider.IncreaseLarge"/>
				</Track.IncreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource PositionSliderThumbStyle}" />
				</Track.Thumb>
			</Track>
			<TickBar
			  x:Name="BottomTick"
			  SnapsToDevicePixels="True"
			  Grid.Row="2"
			  Fill="{TemplateBinding Foreground}"
			  Placement="Bottom"
			  Height="4"
			  Visibility="Collapsed"/>
		</Grid>
		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="PositionSliderTemplate" TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="MinWidth" Value="30" />
				<Setter Property="MinHeight" Value="21" />
				<Setter Property="Template" Value="{StaticResource PositionHorizontalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>

	<!-- Slider Template : Volume -->
	<Style x:Key="VolumeSliderButtonStyle" TargetType="{x:Type RepeatButton}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="IsTabStop" Value="false"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type RepeatButton}">
					<Border Background="Transparent" />
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style x:Key="VolumeSliderThumbStyle" TargetType="{x:Type Thumb}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Setter Property="Focusable" Value="false"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type Thumb}">
					<Grid>
						<Grid x:Name="Ellipse">
							<!--Path
										 Width="9"
										 Height="16"
										 Margin="2,2,0,0"
										 Data="M160,400 L160,310 200,280 240,310 240,400 z"
										 Fill="#8000"
										 Stretch="Fill"
										 Stroke="#8000"/-->
							<Path
							  Width="9"
							  Height="16"
							  Data="M160,400 L160,310 200,280 240,310 240,400 z"
							  Stretch="Fill"
                Fill="{DynamicResource VOGradient01}"
                Stroke="{DynamicResource VOGradient02}">
							</Path>
						</Grid>

						<!--Border
									  x:Name="highlight"
									  CornerRadius="2"
									  Background="{DynamicResource VOColor02}"
									  BorderBrush="#77555555"
									  BorderThickness="1"
									  Opacity="0"/-->
					</Grid>
					<!--ControlTemplate.Triggers>
						<EventTrigger RoutedEvent="Mouse.MouseEnter">
							<BeginStoryboard>
								<Storyboard>
									<DoubleAnimation To="0.7" Duration="00:00:00.2000000" Storyboard.TargetName="highlight" Storyboard.TargetProperty="Opacity" />
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
						<EventTrigger RoutedEvent="Mouse.MouseLeave">
							<BeginStoryboard>
								<Storyboard>
									<DoubleAnimation To="0" Duration="00:00:00.2000000" Storyboard.TargetName="highlight" Storyboard.TargetProperty="Opacity" />
								</Storyboard>
							</BeginStoryboard>
						</EventTrigger>
					</ControlTemplate.Triggers-->
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="VolumeHorizontalSlider" TargetType="{x:Type Slider}">
		<Grid>
			<TickBar
			  x:Name="TopTick"
			  Height="1"
			  Fill="#7FFF"
			  Placement="Top"
			  SnapsToDevicePixels="True"
			  Visibility="Collapsed"/>
			<Path
			  Height="12"
			  Canvas.Top="11.98"
			  Margin="4,0"
			  Data="M80,320 L560,320 560,290 80,315 z"
			  Stretch="Fill"
			  Stroke="#2FFF"
			  StrokeThickness="1">
				<Path.Fill>
					<LinearGradientBrush StartPoint="0.198,0.457" EndPoint="0.215,2.283">
						<GradientStop Offset="0" Color="#3000"/>
						<GradientStop Offset="0.3" Color="#407F7F7F"/>
					</LinearGradientBrush>
				</Path.Fill>
			</Path>
			<Track x:Name="PART_Track" Height="35">
				<Track.DecreaseRepeatButton>
					<RepeatButton Command="Slider.DecreaseLarge" Style="{StaticResource VolumeSliderButtonStyle}"/>
				</Track.DecreaseRepeatButton>
				<Track.Thumb>
					<Thumb Style="{StaticResource VolumeSliderThumbStyle}"/>
				</Track.Thumb>
				<Track.IncreaseRepeatButton>
					<RepeatButton Command="Slider.IncreaseLarge" Style="{StaticResource VolumeSliderButtonStyle}"/>
				</Track.IncreaseRepeatButton>
			</Track>
			<TickBar
			  x:Name="BottomTick"
			  Height="1"
			  Canvas.Top="35"
			  Fill="{TemplateBinding Foreground}"
			  Placement="Bottom"
			  SnapsToDevicePixels="True"
			  Visibility="Collapsed"/>
		</Grid>

		<ControlTemplate.Triggers>
			<Trigger Property="TickPlacement" Value="TopLeft">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="BottomRight">
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
			<Trigger Property="TickPlacement" Value="Both">
				<Setter TargetName="TopTick" Property="Visibility" Value="Visible"/>
				<Setter TargetName="BottomTick" Property="Visibility" Value="Visible"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="VolumeSliderTemplate" TargetType="{x:Type Slider}">
		<Setter Property="SnapsToDevicePixels" Value="true"/>
		<Setter Property="OverridesDefaultStyle" Value="true"/>
		<Style.Triggers>
			<Trigger Property="Orientation" Value="Horizontal">
				<Setter Property="MinWidth" Value="30" />
				<Setter Property="MinHeight" Value="21" />
				<Setter Property="Template" Value="{StaticResource VolumeHorizontalSlider}" />
			</Trigger>
		</Style.Triggers>
	</Style>

</ResourceDictionary>